#!/bin/bash

# Creates a TRALE distribution including trale-sld.

# location of Gralej from repository, e.g.
# /home/ke/workspace/gralej
GRALEJ=${GRALEJ_TRUNK_DIR:?"Please set this environment variable."}

# location of trale-sld from repository, e.g.
# /home/ke/workspace/trale-sld
TRUNK=${TRALESLD_TRUNK_DIR:?"Please set this environment variable."}

# location of original TRALE from Toronto repository, e.g.
# /home/ke/opt/trale.orig
ORIG=${TRALESLD_TRALE_ORIG_DIR:?"Please set this environment variable."}

# location of directory to create the TRALE distribution in, e.g.
# /home/ke/opt/trale.dist
DIST=${TRALESLD_TRALE_DIST_DIR:?"Please set this environment variable."}

rm -rf $DIST
export TRALESLD_TRALE_DEV_DIR=$DIST
cp -r $ORIG $DIST
rm -rf $DIST/chart_display
rm -rf $DIST/docs
rm -rf $DIST/grisu
rm -rf $DIST/grale
export PATSCH_FORCE=yes
$TRUNK/patsch
mkdir $DIST/trale-sld
ant -f $TRUNK/build.xml -Ddist=$DIST/trale-sld -Dgralej=$GRALEJ_TRUNK_DIR dist